<template>
	<section v-loading="listLoading">
		<!--<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
					<el-input clearable v-model="filters.nickname" placeholder="用户昵称"></el-input>
				</el-form-item>
				<el-form-item>
					<el-input clearable v-model="filters.phone" placeholder="手机号码"></el-input>
				</el-form-item>
				<el-form-item label="状态">
		            <el-select v-model="filters.status" clearable> 
		                <el-option v-for="item in option" :key="item.value" :label="item.label" :value="item.value"></el-option>
		            </el-select>
			    </el-form-item>
				<el-form-item>
					<el-button type="primary"  size="medium" v-on:click="handleCurrentChange(1)">查询</el-button>
				</el-form-item>  
			</el-form>
		</el-col>-->
		<!--列表-->
		<el-table :data="users" stripe highlight-current-row @selection-change="selsChange" border style="width: 100%;">
			<el-table-column prop="avatar" label="头像" align="center" width="80">
                <template slot-scope="scope">
                	<el-popover placement="top-start" title="" trigger="click" v-if="scope.row.avatar">
                		<img :src="scope.row.avatar" alt="" style="width: 500px;height: 500px;border-radius:50%; vertical-align:middle;object-fit: cover;"/>
                		<img slot="reference" :src="scope.row.avatar" style="width: 50px;height: 50px;border-radius: 50%;vertical-align: middle;object-fit: cover;"/>
                	</el-popover>
                	
                </template>
            </el-table-column>
            <el-table-column prop="nickname" label="昵称" min-width="60" align="center">
		    </el-table-column>
			<el-table-column prop="nickname" label="手机号码" min-width="60" align="center">
			</el-table-column>
            
			<el-table-column prop="recodeBindTime" label="加入时间" :formatter="formatDate"  min-width="100" align="center">
			</el-table-column>
			
		</el-table>
		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-pagination background layout="prev, pager, next, jumper" @current-change="handleCurrentChange" :page-size="pageSize" :total="total" style="float:right;">
			</el-pagination>
		</el-col>
		
		
	</section>
</template>

<script>
	export default {
		data() {
			return {
				filters: {
					nickname: '',
					status:'',
					phone:'',
				},
				data:{},
				users: [],
				sels: [],
				total: 0,
				page: 1,
				pageSize: 10,
				listLoading: false,
			}
		},
		methods: {
			
			//时间转换开始时间 
			formatDate(row, column) {
                let date = new Date(parseInt(row.recodeBindTime));
                let Y = date.getFullYear() + '-';
                let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) + '-' : date.getMonth() + 1 + '-';
                let D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
                let h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
                let m = date.getMinutes()  < 10 ? '0' + date.getMinutes() + ':' : date.getMinutes() + ':';
                let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
                return Y + M + D + h + m + s;
            },
            
			handleCurrentChange(val) {
				this.page = val;
				this.getUsers();
			},
			//获取用户列表
			getUsers:function (){
				this.listLoading = true;
				let para = {
				    page: this.page,
				    size: this.pageSize,
				    userId:this.$route.query.id,
				};
				var instance = this.$http.create({headers: {'content-type': 'application/x-www-form-urlencoded','admin_five_palace_token':JSON.parse(sessionStorage.getItem('token'))},
				});  
				instance.post('admin/wxUser/getUserTeamList', this.qs.stringify(para)).then(data => {
					let  res = data.data;
					console.log(data);
					if (res.code !== 0) {
						this.$message({
							message: res.msg,
							type: 'error'
						});
					} else {
						console.log(res)
						this.total = res.total;
						this.users = res.rows;
						this.listLoading = false;
					}
				}); 
			},
			dialogClose(){},
			selsChange: function (sels) {
				this.sels = sels;
			},
			
			
		},
		mounted() {
			this.getUsers();
		}
	}

</script>
